import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/components/layout/Layout'
import home from '@/router/menu/home'
// import TabView from '@/components/layout/TabView'

Vue.use(Router)

const routes = [{
  path: '/',
  redirect: '/loading'
},
{
  path: '/login',
  name: 'login',
  meta: {
    title: '登录',
    hidden: true
  },
  component: () => import('@/views/login/index')
},
{
  path: '/loading',
  name: 'loading',
  meta: {
    title: 'loading',
    hidden: true
  },
  component: () => import('@/views/loading/index')
},
{
  path: '/403',
  name: 'err403',
  meta: {
    title: '403',
    hidden: true
  },
  component: () => import('@/views/errorpage/403')
},
{
  path: '*',
  name: 'err404',
  meta: {
    title: '404',
    hidden: true
  },
  component: () => import('@/views/errorpage/404')
},
{
  path: '/500',
  name: 'err500',
  meta: {
    title: '500',
    hidden: true
  },
  component: () => import('@/views/errorpage/500')
},
...home,
{
  path: '/orgMgt',
  meta: {
    title: '组织机构管理',
    icon: 'setUp'
  },
  component: Layout,
  children: [{
    path: 'user',
    name: 'user',
    meta: {
      title: '用户管理',
      icon: 'point'
    },
    component: () => import('@/views/orgMgt/user/index')
  },
  {
    path: 'org',
    name: 'org',
    meta: {
      title: '组织机构',
      icon: 'point'
    },
    component: () => import('@/views/orgMgt/org/index')
  },
  {
    path: 'personnel',
    name: 'personnel',
    meta: {
      title: '人员管理',
      icon: 'point'
    },
    component: () => import('@/views/orgMgt/personnel/index')
  }]
}
]

export default new Router({
  scrollBehavior: () => ({
    y: 0
  }),
  routes
})
